﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using Microsoft.Practices.Unity;
using Vit.Common;
using Vit.Web.Providers;

namespace Vit.Web
{
    public class WebUnity : Vit.Common.Unity
    {
        public static WebUnity Current
        {
            get
            {
                return HttpContext.Current.Application["GlobalUnity"] as WebUnity;
            }
            internal set
            {
                HttpContext.Current.Application["GlobalUnity"] = value;
            }
        }

        public WebUnity(IUnityContainer unityContainer)
            : base(unityContainer)
        {
        }

        public UnityService<IPortalProvider> PortalService
        {
            get
            {
                return UnityContainer.Resolve<UnityService<IPortalProvider>>();
            }
        }

        public UnityService<INavigationProvider> NavigationService
        {
            get
            {
                return UnityContainer.Resolve<UnityService<INavigationProvider>>();
            }
        }
    }
}
